Option Strict Off
Option Explicit On
Namespace BMLERP
	Friend Class frmcust
		Inherits System.Windows.Forms.Form
		Private Sub cmdclose_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdclose.Click
			Me.Close()
		End Sub

		Private Sub cmdPrint_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrint.Click
			If Fdate.Text = "" Or Tdate.Text = "" Then
				MsgBox("You must enter Date!", MsgBoxStyle.Critical, "Warning")
			Else
				CrystalReport2.ReportFileName = DDAN & "\PurbyCustNo.rpt"
				CrystalReport2.RetrieveStoredProcParams()
				CrystalReport2.set_StoredProcParam(0, VB6.Format(Trim(Fdate.Text), "mm/dd/yyyy"))
				CrystalReport2.set_StoredProcParam(1, VB6.Format(Trim(Tdate.Text), "mm/dd/yyyy"))
				CrystalReport2.set_StoredProcParam(2, Trim(custno.Text))
				CrystalReport2.Destination = Crystal.DestinationConstants.crptToWindow
				CrystalReport2.Action = 1
			End If
		End Sub

		Private Sub customer_Change(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles customer.Change
			custno.Text = customer.BoundText
			Fdate.Focus()
		End Sub
		Private Sub Fdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles Fdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				If IsDate(Fdate.Text) = True Then
					Tdate.Focus()
					Tdate.Text = ""
				Else
					MsgBox("Incorrect Date !, Enter again", MsgBoxStyle.Critical, "Warning")
					Fdate.Focus()
					Fdate.Text = ""
				End If
			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub

		Private Sub frmcust_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
			Adodc1.ConnectionString = ConnectString
			Adodc1.CommandTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "select CMCNO,CMCNO + ' : ' + CMNME as CMNME FROM RCM"
			Adodc1.Refresh()
			Fdate.Text = ""
			Tdate.Text = ""
			customer.CtlText = ""
			customer.RowSource = Adodc1
		End Sub
		Private Sub Tdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles Tdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				If IsDate(Tdate.Text) = True Then
					cmdPrint.Focus()
				Else
					MsgBox("Incorrect Date !, Enter again", MsgBoxStyle.Critical, "Warning")
					Tdate.Focus()
					Tdate.Text = ""
				End If
			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub
	End Class
End Namespace